package com.hotel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hotel.entity.OrderDetail;
import com.hotel.entity.ShoppingCart;
import com.hotel.mapper.OrderDetailMapper;
import com.hotel.service.OrderDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 订单明细表 服务实现类
 * </p>
 *
 * @author Lin
 * @since 2022-06-13
 */
@Service
public class OrderDetailServiceImp extends ServiceImpl<OrderDetailMapper, OrderDetail> implements OrderDetailService {

    @Resource
    private OrderDetailMapper mapper;

    @Override
    public List<OrderDetail> getOrderDetail(String orderId) {
        return mapper.getOrderDetail(orderId);
    }

    @Override
    public int deleteOrderDetail(String orderId) {
        QueryWrapper<OrderDetail> wrapper = new QueryWrapper<>();
        wrapper.eq("order_id",orderId);
        return this.baseMapper.delete(wrapper);
    }

}
